#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long NUM;

int main()
{
	NUM result = 1, i, len;

	char str[1000050], t[7];

	for(len = i = 0; len <= 1000000; i++)
	{
		itoa(i, t, 10);
		strcat(str, t);
		len += strlen(str + len);
	}

	for (i = 1; i <= 1000000; i *= 10)
		result *= str[i] - '0';

	printf("Result: %d\n", result);
	return 0;
}
